package com.hqyj.am.controller;


import com.hqyj.am.pojo.Department;
import com.hqyj.am.pojo.ResultVo;
import com.hqyj.am.service.IDepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * <p>
 *  前端控制器
 * </p>
 */
@RestController
@RequestMapping("/department")
public class DepartmentController {

    @Autowired
    IDepartmentService iDepartmentService;

    @GetMapping("/queryByUserId")
    public ResultVo queryByUserId(Integer userId){
        return iDepartmentService.queryByUserId(userId);
    }

    @PostMapping("/insertDepartment")
    public ResultVo insertDepartment(Department department){
        return iDepartmentService.insertDepartment(department);
    }

    @PutMapping("/updateDepartment")
    public ResultVo updateDepartment(Department department){
        return iDepartmentService.updateDepartment(department);
    }

    @DeleteMapping("/deleteDepartment")
    public ResultVo deleteDepartment(Department department){
        return iDepartmentService.deleteDepartment(department);
    }
}

